package com.mec.web.y2012.coreservlet;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.log4j.Logger;

public class BeanUtilities {
	public static void populateBean(Object formBean, HttpServletRequest request){
		populateBean(formBean, request.getParameterMap());
	}
	
	public static void populateBean(Object bean, Map propertyMap){
		try{
			BeanUtils.populate(bean, propertyMap);
		}catch(Exception e){
			logger.error("Populate Bean error: ", e);
		}
	}
	private static final Logger logger = 
			Logger.getLogger(BeanUtilities.class);

}
